<?php

/**
 * Upload de photo dans le BO : Annonce - ajout
 * Récupère $_FILES et fait un redirect vers la classe commun
 *
 *
 */
     
 if (isset($_FILES['uploadfile']) && !empty($_FILES['uploadfile'])) {
     try {
        
        
        $tempFile   = $_FILES['uploadfile']['tmp_name'];
       // $targetPath = '/var/www/auto-occasion/srcs/';
        //$targetPath = '/var/www/auto-occasion/srcs/media/annonce/';
        
        $targetPath = 'media/annonce/';
        $targetFile =  str_replace('//','/',$targetPath) . $_FILES['uploadfile']['name'];
        move_uploaded_file($tempFile,$targetFile);
        echo "success";

     } catch (exception $e) {
         die($e->getMessage());

     }
    
 }